home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OInterfaces / GXMath.mod < prev    next >
Encoding:
Text File  |  1995-08-10  |  6.4 KB  |  150 lines  |  [TEXT/MPS ]

  1. (*
  2.      File:        GXMath.mod
  3.  
  4.      Contains:    QuickDraw GX math routine interfaces.
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs.applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. *)
  19.  
  20. (*$TAGS-*)
  21. (*$CALLING PASCAL*)
  22. MODULE GXMath;
  23.  
  24. IMPORT SYSTEM, Types;
  25.  
  26. (* $PUSH*)
  27. (* $ALIGN MAC68K*)
  28. (* $LibExport+*)
  29. (*$SET mathTypesIncludes TRUE*)
  30.  
  31. TYPE
  32.     gxPointPtr* = POINTER TO gxPoint;
  33.     gxPoint* = RECORD
  34.         x*:                        Types.Fixed;
  35.         y*:                        Types.Fixed;
  36.     END;
  37.  
  38.     gxColorValue* = INTEGER;
  39.  
  40.     gxPolarPtr* = POINTER TO gxPolar;
  41.     gxPolar* = RECORD
  42.         radius*:                    Types.Fixed;
  43.         angle*:                    Types.Fixed;
  44.     END;
  45.  
  46.     gxMappingPtr* = POINTER TO gxMapping;
  47.     gxMapping* = RECORD
  48.         map*:                    ARRAY 3,3 (*ΔΔ[0..2,0..2]ΔΔ*) OF Types.Fixed;
  49.     END;
  50.  
  51.  
  52. CONST
  53.     gxColorValue1*                = $0000FFFF;                    (* gxColorValue 1.0 *)
  54.     gxPositiveInfinity*            = $7FFFFFFF;                    (* for Types.Fixed and Types.Fract *)
  55.     gxNegativeInfinity*            = $80000000;                    (* for Types.Fixed and Types.Fract *)
  56.  
  57. (*$SET mathRoutinesIncludes TRUE*)
  58.  
  59. PROCEDURE CopyToMapping*(VAR target: gxMapping; (*CONST*)VAR source: gxMapping): gxMappingPtr; (*ΔΔC;ΔΔ*)
  60.     EXTERNAL (*•• C*);
  61. PROCEDURE InvertMapping*(VAR target: gxMapping; (*CONST*)VAR source: gxMapping): gxMappingPtr; (*ΔΔC;ΔΔ*)
  62.     EXTERNAL (*•• C*);
  63. PROCEDURE MapMapping*(VAR target: gxMapping; (*CONST*)VAR source: gxMapping): gxMappingPtr; (*ΔΔC;ΔΔ*)
  64.     EXTERNAL (*•• C*);
  65. PROCEDURE MoveMapping*(VAR target: gxMapping; hOffset: Types.Fixed; vOffset: Types.Fixed): gxMappingPtr; (*ΔΔC;ΔΔ*)
  66.     EXTERNAL (*•• C*);
  67. PROCEDURE MoveMappingTo*(VAR target: gxMapping; hPosition: Types.Fixed; vPosition: Types.Fixed): gxMappingPtr; (*ΔΔC;ΔΔ*)
  68.     EXTERNAL (*•• C*);
  69. PROCEDURE NormalizeMapping*(VAR target: gxMapping): gxMappingPtr; (*ΔΔC;ΔΔ*)
  70.     EXTERNAL (*•• C*);
  71. PROCEDURE RotateMapping*(VAR target: gxMapping; angle: Types.Fixed; xCenter: Types.Fixed; yCenter: Types.Fixed): gxMappingPtr; (*ΔΔC;ΔΔ*)
  72.     EXTERNAL (*•• C*);
  73. PROCEDURE ScaleMapping*(VAR target: gxMapping; hFactor: Types.Fixed; vFactor: Types.Fixed; xCenter: Types.Fixed; yCenter: Types.Fixed): gxMappingPtr; (*ΔΔC;ΔΔ*)
  74.     EXTERNAL (*•• C*);
  75. PROCEDURE ResetMapping*(VAR target: gxMapping): gxMappingPtr; (*ΔΔC;ΔΔ*)
  76.     EXTERNAL (*•• C*);
  77. PROCEDURE SkewMapping*(VAR target: gxMapping; skewX: Types.Fixed; skewY: Types.Fixed; xCenter: Types.Fixed; yCenter: Types.Fixed): gxMappingPtr; (*ΔΔC;ΔΔ*)
  78.     EXTERNAL (*•• C*);
  79. PROCEDURE MapPoints*((*CONST*)VAR source: gxMapping; count: LONGINT; vector: gxPoint); (*ΔΔC;ΔΔ*)
  80.     EXTERNAL (*•• C*);
  81. PROCEDURE FirstBit*(x: LONGINT): INTEGER; (*ΔΔC;ΔΔ*)
  82.     EXTERNAL (*•• C*);
  83. PROCEDURE WideScale*((*CONST*)VAR source: Types.wide): INTEGER; (*ΔΔC;ΔΔ*)
  84.     EXTERNAL (*•• C*);
  85. PROCEDURE LinearRoot*(first: Types.Fixed; last: Types.Fixed; t: Types.Fract): INTEGER; (*ΔΔC;ΔΔ*)
  86.     EXTERNAL (*•• C*);
  87. PROCEDURE QuadraticRoot*(first: Types.Fixed; control: Types.Fixed; last: Types.Fixed; t: Types.Fract): INTEGER; (*ΔΔC;ΔΔ*)
  88.     EXTERNAL (*•• C*);
  89. PROCEDURE PolarToPoint*((*CONST*)VAR ra: gxPolar; VAR xy: gxPoint): gxPointPtr; (*ΔΔC;ΔΔ*)
  90.     EXTERNAL (*•• C*);
  91. PROCEDURE PointToPolar*((*CONST*)VAR xy: gxPoint; VAR ra: gxPolar): gxPolarPtr; (*ΔΔC;ΔΔ*)
  92.     EXTERNAL (*•• C*);
  93. PROCEDURE FractCubeRoot*(source: Types.Fract): Types.Fract; (*ΔΔC;ΔΔ*)
  94.     EXTERNAL (*•• C*);
  95. PROCEDURE FractDivide*(dividend: Types.Fract; divisor: Types.Fract): Types.Fract; (*ΔΔC;ΔΔ*)
  96.     EXTERNAL (*•• C*);
  97. PROCEDURE FractMultiply*(multiplicand: Types.Fract; multiplier: Types.Fract): Types.Fract; (*ΔΔC;ΔΔ*)
  98.     EXTERNAL (*•• C*);
  99. PROCEDURE FractSineCosine*(degrees: Types.Fixed; VAR cosine: Types.Fract): Types.Fract; (*ΔΔC;ΔΔ*)
  100.     EXTERNAL (*•• C*);
  101. PROCEDURE FractSquareRoot*(source: Types.Fract): Types.Fract; (*ΔΔC;ΔΔ*)
  102.     EXTERNAL (*•• C*);
  103. PROCEDURE FixedDivide*(dividend: Types.Fixed; divisor: Types.Fixed): Types.Fixed; (*ΔΔC;ΔΔ*)
  104.     EXTERNAL (*•• C*);
  105. PROCEDURE FixedMultiply*(multiplicand: Types.Fixed; multiplier: Types.Fixed): Types.Fixed; (*ΔΔC;ΔΔ*)
  106.     EXTERNAL (*•• C*);
  107. (* This next call is (source * multiplier / divisor) -- it avoids underflow, overflow by using wides *)
  108. PROCEDURE MultiplyDivide*(source: LONGINT; multiplier: LONGINT; divisor: LONGINT): LONGINT; (*ΔΔC;ΔΔ*)
  109.     EXTERNAL (*•• C*);
  110. PROCEDURE Magnitude*(deltaX: LONGINT; deltaY: LONGINT): LONGINT; (*ΔΔC;ΔΔ*)
  111.     EXTERNAL (*•• C*);
  112. PROCEDURE VectorMultiplyDivide*(count: LONGINT; (*CONST*)VAR vector1: LONGINT; step1: LONGINT; (*CONST*)VAR vector2: LONGINT; step2: LONGINT; divisor: LONGINT): LONGINT; (*ΔΔC;ΔΔ*)
  113.     EXTERNAL (*•• C*);
  114. (* wide operations are defined within FixMath.h only for PowerPC *)
  115. (*$IF NOT GENERATINGPOWERPC *)
  116. PROCEDURE WideAdd*(VAR target: Types.wide; (*CONST*)VAR source: Types.wide)(*ΔΔ : Types.wide*); (*ΔΔC;ΔΔ*)
  117.     EXTERNAL (*•• C*);
  118. PROCEDURE WideCompare*((*CONST*)VAR target: Types.wide; (*CONST*)VAR source: Types.wide): INTEGER; (*ΔΔC;ΔΔ*)
  119.     EXTERNAL (*•• C*);
  120. PROCEDURE WideNegate*(VAR target: Types.wide)(*ΔΔ : Types.wide*); (*ΔΔC;ΔΔ*)
  121.     EXTERNAL (*•• C*);
  122. PROCEDURE WideShift*(VAR target: Types.wide; shift: LONGINT)(*ΔΔ : Types.wide*); (*ΔΔC;ΔΔ*)
  123.     EXTERNAL (*•• C*);
  124. PROCEDURE WideSquareRoot*((*CONST*)VAR source: Types.wide): LONGINT; (*ΔΔC;ΔΔ*)
  125.     EXTERNAL (*•• C*);
  126. PROCEDURE WideSubtract*(VAR target: Types.wide; (*CONST*)VAR source: Types.wide)(*ΔΔ : Types.wide*); (*ΔΔC;ΔΔ*)
  127.     EXTERNAL (*•• C*);
  128. PROCEDURE WideMultiply*(multiplicand: LONGINT; multiplier: LONGINT; VAR target: Types.wide)(*ΔΔ : Types.wide*); (*ΔΔC;ΔΔ*)
  129.     EXTERNAL (*•• C*);
  130. (* returns the quotient *)
  131. PROCEDURE WideDivide*((*CONST*)VAR dividend: Types.wide; divisor: LONGINT; VAR remainder: LONGINT): LONGINT; (*ΔΔC;ΔΔ*)
  132.     EXTERNAL (*•• C*);
  133. (* quotient replaces dividend *)
  134. PROCEDURE WideWideDivide*(VAR dividend: Types.wide; divisor: LONGINT; VAR remainder: LONGINT)(*ΔΔ : Types.wide*); (*ΔΔC;ΔΔ*)
  135.     EXTERNAL (*•• C*);
  136. (*$END*)
  137. PROCEDURE VectorMultiply*(count: LONGINT; (*CONST*)VAR vector1: LONGINT; step1: LONGINT; (*CONST*)VAR vector2: LONGINT; step2: LONGINT; VAR dot: Types.wide)(*ΔΔ : Types.wide*); (*ΔΔC;ΔΔ*)
  138.     EXTERNAL (*•• C*);
  139. PROCEDURE RandomBits*(count: LONGINT; focus: LONGINT): LONGINT; (*ΔΔC;ΔΔ*)
  140.     EXTERNAL (*•• C*);
  141. PROCEDURE SetRandomSeed*((*CONST*)VAR seed: Types.wide); (*ΔΔC;ΔΔ*)
  142.     EXTERNAL (*•• C*);
  143. PROCEDURE GetRandomSeed*(VAR seed: Types.wide)(*ΔΔ : Types.wide*); (*ΔΔC;ΔΔ*)
  144.     EXTERNAL (*•• C*);
  145.  
  146. (* $ALIGN RESET*)
  147. (* $POP*)
  148.  
  149.  END GXMath.
  150.